package fr.vod.ihm.adapter;

import android.content.Context;
import android.graphics.Point;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.MediaController;
import fr.vod.videoshareucp.R;

public class VideoController extends MediaController {
	private Context mContext;
	public Button fullScreenButton;

	public VideoController(Context context) {
		super(context);
		this.mContext = context;
		fullScreenButton = new Button(mContext);
	}

	@Override
	public void setAnchorView(View view) {
		super.setAnchorView(view);
		fullScreenButton.setBackgroundResource(R.drawable.button_full_screen);
		FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		params.gravity = Gravity.RIGHT;
		params.rightMargin = 20;
		params.topMargin = 20;
		//trouver equation qui fait 40 avec la résolution de la nexus 2012 pour calcul de nexus 2013
		WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
		Display display = wm.getDefaultDisplay();
		Point size = new Point();
		display.getSize(size);
		int screenWidth = size.x;
		int screenHeight = size.y;
		//Log.i(this.getClass().getName(), "screen width : "+ screenWidth + "screen height : "+screenHeight);
		params.height = (int)(screenHeight*0.05);
		params.width = (int)(screenWidth*0.0325);
		
		addView(fullScreenButton, params);
	}

	public void hide() {
		super.show(1);
	}

	public void show() {
		super.show();
	}

	public void show(int timeout) {
		super.show(timeout);
	}

}
